<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>网站Logo</title>
    {template 'stourtravel/public/public_min_js'}
    {php echo Common::getCss('style.css,base.css,base_new.css'); }
    {php echo Common::getScript('imageup.js,config.js');}
    {php echo Common::getScript("uploadify/jquery.uploadify.min.js"); }
    {php echo Common::getCss('uploadify.css','js/uploadify/'); }
</head>
<body>
<table class="content-tab">
    <tr>
        <td width="119px" class="content-lt-td" valign="top">
            {template 'stourtravel/public/leftnav'}
            <!--右侧内容区-->
        </td>
        <td valign="top" class="content-rt-td">
            <form id="configfrm">
                <div class="w-set-con">
                    <div class="cfg-header-bar">
                        <a href="javascript:;" class="fr btn btn-primary radius mt-6 mr-10" onclick="window.location.reload()">刷新</a>
                    </div>
                    <div class="w-set-nr">
                        <ul class="info-item-block">
                            <li class="">
                                <span class="item-hd">企业微信群二维码：</span>
                                <div class="item-bd">
                                    <div class="">
                                        <div id="pic_btn" class="btn btn-primary radius size-S mt-3">上传</div>
                                    </div>
                                    <div class="up-list-div">
                                        <input type="hidden" name="cfg_{$table}_consulting_code" id="code_img" value="{php echo $config['cfg_'.$table.'_consulting_code']}"/>
                                        <ul class="pic-sel">
                                            {if $config['cfg_'.$table.'_consulting_code']}
                                            <li class="img-li">
                                                <img class="fl" src="{php echo $config['cfg_'.$table.'_consulting_code']}" width="100" height="100">
                                                <p class="p2">
                                                    <span class="btn-closed" onclick="$(this).parent().parent().remove();$('#code_img').val('');"></span>
                                                </p>
                                            </li>
                                            {/if}
                                        </ul>
                                    </div>
                                </div>
                            </li>
                            <li class="">
                                <span class="item-hd">是否开启咨询服务：</span>
                                <div class="item-bd">
                                    <label class="radio-label mr-10">
                                        <input type="radio" class="is-open" name="cfg_{$table}_consulting_is_open" {if $config['cfg_'.$table.'_consulting_is_open']==1}checked="checked"{/if} value="1">开启
                                    </label>
                                    <label class="radio-label ml-10">
                                        <input type="radio" class="is-open is-opens" name="cfg_{$table}_consulting_is_open" {if $config['cfg_'.$table.'_consulting_is_open']!=1}checked="checked"{/if} value="0">关闭
                                    </label>
                                </div>
                            </li>
                        </ul>
                        <div class="clear clearfix mt-5">
                            <a class="btn btn-primary size-L radius ml-115" href="javascript:;" id="btn_save">保存</a>
                        </div>
                    </div>
                </div>
            </form>
        </td>
    </tr>
</table>
<script>
    var code_name = "cfg_{$table}_consulting_code";
    $(function () {
        $('#btn_save').click(function () {
            var code_img = $('#code_img').val();
            var is_open = $('.is-open:checked').val();
            if(is_open==1 && !code_img){
                ST.Util.showMsg('请先上传二维码');
                $('.is-opens').attr('checked','checked');
            }
            Config.saveConfig(0);
        });

        $('#pic_btn').click(function () {
            ST.Util.showBox('上传二维码', SITEURL + 'image/insert_view', 0, 0, null, null, document, {
                loadWindow: window,
                loadCallback: Insert
            });

            function Insert(result, bool) {
                var temp = result.data[0].split('$$');
                Imageup.genePic(temp[0], ".up-list-div ul", ".cover-div", temp[1]);
                var html = '<li class="img-li">';
                html+= '<img class="fl" src="'+temp[0]+'" width="100" height="100">';
                html+= '<p class="p2">';
                html+= '<span class="btn-closed" onclick="Imageup.delImg(this,'+temp[0]+',1)"></span>';
                html+= '</p>';
                html+= '</li>';
                $('.pic-sel').html(html);
                $('#code_img').val(temp[0]);
            }
        })
    })
</script>
</body>
</html>